package com.example.abc.websocket.msg;

import java.util.Date;

/**
 * Created by Peter on 2018/5/6.
 */
public class WsMessageFactory {
    /**
     *
     * @param toUid 接收人uid
     * @param reason 退出系统的原因
     * @return LogoutMsg
     */
    public static WsBaseMessage createLogoutMsg(String toUid, String reason) {
        WsBaseMessage baseMessage = new WsBaseMessage(WsMsgType.logout.name());
        LogoutMsg logoutMsg = new LogoutMsg();
        logoutMsg.setFrom("system");
        logoutMsg.setTo(toUid);
        logoutMsg.setLogoutReason(reason);
        logoutMsg.setCreateDate(new Date());
        baseMessage.setData(logoutMsg);
        return baseMessage;
    }
}
